//
//  PlanRecommendModel.m
//  WanCaiC8
//
//  Created by tangang on 2018/4/27.
//  Copyright © 2018年 tangang. All rights reserved.
//

#import "PlanRecommendModel.h"
#import "NSDateFormatter+CacheDateFormatter.h"
@implementation PlanRecommendModel

@end

@implementation RecommendModel
- (NSMutableArray *)arr{
    if (!_arr) {
        _arr=[[NSMutableArray alloc]init];
    }
    return _arr;
}

- (void)setOpenNum:(NSString *)OpenNum{
    _OpenNum=OpenNum;
    _OpenNumArr=[OpenNum componentsSeparatedByString:@","];
    if (_OpenNumArr.count>0) {
        NSInteger count=0;
        for (int i=0; i<_OpenNumArr.count; i++) {
            [self.PCArr addObject:_OpenNumArr[i]];
            count+=[_OpenNumArr[i] integerValue];
            [self.PCArr addObject:@"+"];
        }
        [self.PCArr replaceObjectAtIndex:self.PCArr.count-1 withObject:@"="];
        [self.PCArr addObject:[NSString stringWithFormat:@"%ld",count]];
        [self.LotteryArr addObjectsFromArray:_OpenNumArr];
        [self.LotteryArr insertObject:@"+" atIndex:_OpenNumArr.count-1];
    }
}

- (void)setOpenNumAlias:(NSString *)OpenNumAlias{
    _OpenNumAlias=OpenNumAlias;
    NSMutableArray *arr=[[OpenNumAlias componentsSeparatedByString:@","] mutableCopy];
    if (OpenNumAlias.length>0) {
        if (arr.count==7) {
            [arr insertObject:@"+" atIndex:6];
        }else{
            OpenNumAlias=[OpenNumAlias stringByReplacingOccurrencesOfString:@"龙," withString:@""];
            OpenNumAlias=[OpenNumAlias stringByReplacingOccurrencesOfString:@"虎," withString:@""];
            OpenNumAlias=[OpenNumAlias stringByReplacingOccurrencesOfString:@"龙" withString:@""];
            OpenNumAlias=[OpenNumAlias stringByReplacingOccurrencesOfString:@"虎" withString:@""];
        }
        
        
        
        _OpenNumAliasArr=arr;
        
    }
    
}

- (void)setOpenTime:(NSString *)OpenTime{
    NSArray *str=[OpenTime componentsSeparatedByString:@"."];
    if (str.count>0) {
        OpenTime=str[0];
    }
    str=[OpenTime componentsSeparatedByString:@"+"];
    if (str.count>0) {
        OpenTime=str[0];
    }
    
//    NSDate *date=[TGTools dateFormatter:@"yyyy-MM-dd'T'HH:mm:ss" andString:OpenTime];
//    _OpenTime=[TGTools dateFormatter:@"MM-dd HH:mm" andDate:date];
    
    
    ////    NSDate *date = [NSDateFormatter easyDateFormatterWithIso8601String:OpenTime];

    //    [NSDateFormatter dateFormatterWithRestrictStr:@"%m-%d %H:%M"  TimeStamp:OpenTime];

    _OpenTime = [[TGToolForDateFormatter shareInstance] userVisibleDateTimeStringForRFC3339DateTimeString:OpenTime];

}

- (NSMutableArray *)PCArr{
    if (!_PCArr) {
        _PCArr=[[NSMutableArray alloc]init];
    }
    return _PCArr;
}

- (NSMutableArray *)LotteryArr{
    if (!_LotteryArr) {
        _LotteryArr=[[NSMutableArray alloc]init];
    }
    return _LotteryArr;
}

@end
